package io.modifier.basic.compose.hooks.data

import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.snapshots.SnapshotStateList
import androidx.compose.runtime.toMutableStateList

/** More convenient to use dynamic List state **/
@Composable
fun <T> useList(elements: Collection<T>): SnapshotStateList<T> = remember {
    elements.toMutableStateList()
}

@Composable
fun <T> useList(vararg elements: T): SnapshotStateList<T> = remember {
    mutableStateListOf(*elements)
}
